package com.starblink.frame.base.activity

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.starblink.frame.base.IBaseView


/**
 * 最底层的Activity,不带MVP和MVVM,一般不用这个
 */
abstract class AbsActivity() : AppCompatActivity(), IBaseView{


    /**
     * 获取Context对象
     */
    protected lateinit var mActivity: Activity
    protected lateinit var mContext: Context


    /**
     * 从intent中解析数据，具体子类来实现
     */
    open protected fun getDataFromIntent(intent: Intent) {}

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mActivity = this
        mContext = this.applicationContext


        //获取intent传递的数据
        if (intent != null) {
            getDataFromIntent(intent)
        }
    }

    override fun popSelf() {
        finish()
    }

}
